/**
 * 维护在node全局变量中
 * */
const {app, ipcMain} = require('electron')
const {join, dirname} = require('path')
// 获取当前应用的根目录路径,生产环境下，为app.asar，开发环境下，为lize-tools-pc项目目录
const appRootPath = app.getAppPath();

// 获取 app.asar 所在的目录，即app.asar的父目录
const appDirectory = dirname(appRootPath);

process.env.type = 'electron'
process.env.DIST = join(appRootPath, 'dist') //生产环境，dist目录
process.env.devRoot = appRootPath //运行环境，项目根目录

if (app.isPackaged) {
    process.env.root = process.env.DIST
    process.env.electronResources = join(appDirectory, 'electron/resources') //poblic中的electron目录
} else {
    process.env.root = process.env.devRoot
    process.env.electronResources = join(process.env.devRoot, 'electron/resources') //poblic中的electron目录

}